Tips and Tricks for improving RStudio IDE Development Efficiency
Tuesday, August 1, 2023
This presentation will show you examples of what you can do with RStudio IDE, including:
RStudio projects make it straightforward to divide your work into multiple contexts, each with their own working directory, workspace, history, and source documents.
Isolates your development environment.
Relative path referencing for your project files.
Helps setup project package management via renv or packrat
Segregate development flow and context.
Use your RStudio IDE Toolbar:
File –> New Project –> (Choose) New Directory/Existing Directory/Version ControlThe available options for the RStudio IDE are accessible from the Options dialog - Tools > Global Options menu.
Knowing how to toggle between panes without touching your mouse to move your cursor will help save time and improve your workflow. Use the following shortcuts to switch between panes seamlessly (Mac/Windows):
Control/Ctrl + 1: Source editor (your script)
Control/Ctrl + 2: Console
Control/Ctrl + 3: Help
Control/Ctrl + 4: History
Control/Ctrl + 5: Files
Control/Ctrl + 6: Plots
Control/Ctrl + 7: Packages
Control/Ctrl + 8: Environment
Control/Ctrl + 9: Viewer
If you prefer to only have one pane in view at a time, add Shift to any of the previous commands to maximize the pane. Use the following shortcuts to bring a panes into primary focus seamlessly (Mac/Windows):
Control/Ctrl + Shift + 1: Source editor (your script) pane only
Control/Ctrl + Shift + 2: Console pane only
Control/Ctrl + Shift + 3: Help pane only
Control/Ctrl + Shift + 4: History pane only
Control/Ctrl + Shift + 5: Files pane only
Control/Ctrl + Shift + 6: Plots pane only
Control/Ctrl + Shift + 7: Packages pane only
Control/Ctrl + Shift + 8: Environment pane only
Control/Ctrl + Shift + 9: Viewer pane only
Wait! How do I go back to the classic four-pane view?
Control/Ctrl + Shift + 0 (Mac/Windows): Four-pane RStudio IDE View
RStudio provides dozens of useful shortcuts that you can access through the menu at the top:
Tools > Keyboard Shortcuts Help.
| Description | Windows & Linux | Mac |
|---|---|---|
| Shift focus of cursor to Console | Ctrl + 2 |
Control + 2 |
| Clear Console | Ctrl + L |
Control + L |
| Move Cursor to beginning of a line | Home |
Cmd + Left |
| Move Cursor to end of a line | End |
Cmd + Right |
| Move Cursor to start/end of a word | Alt + Left/Rigth |
Option + Left/Right |
| Navigate command history | Up/Down |
Up/Down |
| Pop-up Command history | Ctrl + Up |
Cmd + Up |
| Description | Windows & Linux | Mac |
|---|---|---|
| Toggle document outline | Ctrl + Shift + O |
Cmd + Shift + O |
| Clear Console | Ctrl + L |
Control + L |
| New R Script | Ctrl + Shift + N |
Cmd + Shift + N |
| Save active document | Ctrl + S |
Cmd + S |
| Save all documents | Ctrl + Alt + S |
Cmd + Option + S |
| Close active document | Ctrl + W |
Cmd + W |
| Close all open documents | Ctrl + Shift + W |
Cmd + Shift + W |
| Knit and Preview Document (knitr) | Ctrl + Shift + K |
Cmd + Shift + K |
| Insert Chunk | Ctrl + Alt + I |
Cmd + Option + I |
| Description | Windows & Linux | Mac |
|---|---|---|
| Find and Replace | Ctrl + F |
Cmd + F |
| Find in Files | Ctrl + Shift + F |
Cmd + Shift + F |
| Description | Windows & Linux | Mac |
|---|---|---|
Insert Assignment Operator (<-) |
Alt + - (hyphen/minus) |
Option + - (hyphen/minus) |
Insert Pipe Operator (%>%) |
Ctrl + Shift + M |
Cmd + Shift + M |
| Description | Windows & Linux | Mac |
|---|---|---|
| Re-indent lines | Ctrl + I |
Cmd + I |
| Comment/un-comment current line/selection | Ctrl + Shift + C |
Cmd + Shift + C |
| Reformat Selection | Ctrl + Shift + A |
Cmd + Shift + A |
| Move Lines Up/Down | Alt + Up/Down |
Option + Up/Down |
| Copy Lines Up/Down | Shift + Alt + Up/Down |
Cmd + Option + Up/Down |
| Jump to Matching Brace/Parenthesis | Ctrl + P |
Control + P |
| Add Cursor Above/Below Current Cursor | Ctrl + Alt + Up/Down |
Control + Option + Up/Down |
| (Alternate) Add Cursor via drag | Alt + drag mouse pointer |
Option + drag mouse pointer |
| Delete Current Line | Ctrl + D |
Cmd + D |
| Insert Roxygen Skeleton | Ctrl + Alt + Shift + R |
Cmd + Option + Shift + R |
| Attempt Code Completion | Tab or Ctrl + Space |
Tab or Cmd + Space |
| Description | Windows & Linux | Mac |
|---|---|---|
| Run current line/selection | Ctrl + Enter |
Cmd + Return |
| Run current document | Ctrl + Alt + R |
Cmd + Option + R |
| Send current line/selection to terminal | Ctrl + Alt + Enter |
Cmd + Option + Return |
| Fold Selected | Alt + L |
Cmd +``Option + L |
| Unfold Selected | Shift + Alt + L |
Cmd + Shift + Option + L |
| Fold All | Alt + O |
Cmd + Option + O |
| Unfold All | Shift + Alt + O |
Cmd + Shift + Option + O |
| Description | Windows & Linux | Mac |
|---|---|---|
| Switch to tab | Ctrl + Shift +. [period] |
Control + Shift + . [period] |
| Next tab (desktop) | Ctrl + Tab |
Control + Tab |
| Previous tab (desktop) | Ctrl + Shift + Tab |
Control + Shift + Tab |
| (Alternate) Shift between tabs left/right | Ctrl + Alt + left/right |
Control + Option + left/right |
| Next tab (Workbench) | Ctrl + F12 |
Control + F12 |
| Previous tab (Workbench) | Ctrl + F11 |
Control + F11 |
| Description | Windows & Linux | Mac |
|---|---|---|
| Move Focus to Terminal | Alt + Shift + M |
Shift + Option + M |
| New Terminal | Alt + Shift + R |
Shift + Option + R |
| Description | Windows & Linux | Mac |
|---|---|---|
| Restart R session | Ctrl + Shift + 0 |
Cmd + Shift + 0 |
A collection of R Shiny examples by Posit GitHub
Hello Quarto Tutorial Link
Reveal JS Slides: Basics Advanced Presenting Slides Themes All Options
Making Slides with Quarto by Tom Mock (2022-07-25) Link
Slidecraft 101: Colors and Fonts - All about colors and fonts in slide crafting Link
Posit Cheat Sheets Link
R Tutorials Series - Afternoon Session - 31 July 2023